<template>
    <view class="container data-v-15194c1f" :style="'padding-top:' + navBar + 150 + 'px'">
        <text-nav-bar @__l="__l" class="data-v-15194c1f" title="活动邀请记录" vueId="ef28c86c-1"></text-nav-bar>
        <view class="top data-v-15194c1f" :style="'padding-top:' + navBar + 'px'">
            <view class="card data-v-15194c1f">
                <image class="headimg data-v-15194c1f" mode="aspectFill" :src="userInfo.headimg"></image>
                <view class="right data-v-15194c1f">
                    <view class="bar data-v-15194c1f">
                        <view class="item data-v-15194c1f">
                            <view class="number data-v-15194c1f">{{ inviteTotal }}</view>
                            <view class="key data-v-15194c1f">邀请人数</view>
                        </view>
                        <view class="item data-v-15194c1f">
                            <view class="number data-v-15194c1f">{{ stock }}</view>
                            <view class="key data-v-15194c1f">可用次数</view>
                        </view>
                        <view class="item data-v-15194c1f">
                            <view class="number data-v-15194c1f">{{ usedTotal }}</view>
                            <view class="key data-v-15194c1f">已抽次数</view>
                        </view>
                    </view>
                </view>
            </view>
            <view class="header-tabs data-v-15194c1f">
                <view @tap="__e" :class="['tab-item', 'data-v-15194c1f', current == 0 ? 'active' : '']" :data-current="0" :data-event-opts="[['tap', [['e0', ['$event']]]]]">
                    <text class="text data-v-15194c1f">邀请记录</text>
                </view>
                <view @tap="__e" :class="['tab-item', 'data-v-15194c1f', current == 1 ? 'active' : '']" :data-current="1" :data-event-opts="[['tap', [['e1', ['$event']]]]]">
                    <text class="text data-v-15194c1f">次数记录</text>
                </view>
            </view>
            <view class="swiper-wrapper data-v-15194c1f">
                <swiper @change="__e" class="data-v-15194c1f" :current="current" :data-event-opts="[['change', [['swiperChange', ['$event']]]]]">
                    <swiper-item class="data-v-15194c1f">
                        <scroll-view @scrolltolower="__e" class="list data-v-15194c1f" :data-event-opts="[['scrolltolower', [['scrolltolower', ['$event']]]]]" :scrollY="true">
                            <user-item
                                @__l="__l"
                                class="data-v-15194c1f"
                                :info="item"
                                :vueId="'ef28c86c-2-' + index"
                                v-for="(item, index) in userList.list"
                                :key="index"
                            ></user-item>
                            <view class="data-v-15194c1f" style="height: 50rpx"></view>
                            <no-data @__l="__l" class="data-v-15194c1f" vueId="ef28c86c-3" v-if="!$root.g0"></no-data>
                        </scroll-view>
                    </swiper-item>
                    <swiper-item class="data-v-15194c1f">
                        <scroll-view @scrolltolower="__e" class="list data-v-15194c1f" :data-event-opts="[['scrolltolower', [['scrolltolower', ['$event']]]]]" :scrollY="true">
                            <ticket-item
                                @__l="__l"
                                class="data-v-15194c1f"
                                :info="item"
                                :vueId="'ef28c86c-4-' + index"
                                v-for="(item, index) in ticketList.list"
                                :key="index"
                            ></ticket-item>
                            <view class="data-v-15194c1f" style="height: 50rpx"></view>
                            <no-data @__l="__l" class="data-v-15194c1f" vueId="ef28c86c-5" v-if="!$root.g1"></no-data>
                        </scroll-view>
                    </swiper-item>
                </swiper>
            </view>
        </view>
        <view class="footer-c global-shadow safe-area-bottom data-v-15194c1f">
            <view class="btn-c data-v-15194c1f">
                <button @tap="__e" class="btn check-rule data-v-15194c1f" :data-event-opts="[['tap', [['checkRule', ['$event']]]]]">查看邀请规则</button>
                <view @tap="__e" class="btn data-v-15194c1f" :data-event-opts="[['tap', [['handleShare', ['$event']]]]]">转发邀请</view>
            </view>
        </view>
        <rule
            @__l="__l($event, { eventOpts: [['^cancel', [['e2']]]] })"
            @cancel="__e($event, { eventOpts: [['^cancel', [['e2']]]] })"
            class="data-v-15194c1f"
            :data-event-opts="[['^cancel', [['e2']]]]"
            :info="info"
            vueId="ef28c86c-6"
            v-if="isShowRule"
        ></rule>
    </view>
</template>

<script>
import textNavBar from '@/components/TextNavBar/TextNavBar';
import noData from '@/components/NoData/NoData';
import ticketItem from '@/pages/activityTicket/components/TicketItem';
import userItem from '@/pages/activityTicket/components/UserItem';
import rule from '@/pages/activityTicket/components/Rule';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/activityTicket/record'],
    {
        '391f': function (t, e, i) {
            'use strict';

            i.r(e);
            var n = i('b302');
            var a = i('c86e');
            for (var u in a) {
                if (['default'].indexOf(u) < 0) {
                    (function (t) {
                        i.d(e, t, function () {
                            return a[t];
                        });
                    })(u);
                }
            }
            i('c753');
            var s = i('f0c5');
            var c = Object(s.a)(a.default, n.b, n.c, false, null, '15194c1f', null, false, n.a, void 0);
            e.default = c.exports;
        },
        '871e': function (t, e, i) {},
        aa95: function (t, e, i) {
            'use strict';

            (function (t) {
                var n = i('4ea4');
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var a = n(i('2eee'));
                var u = n(i('448a'));
                var s = n(i('c973'));
                var c = {
                    components: {
                        TicketItem: function () {
                            i.e('pages/activityTicket/components/TicketItem')
                                .then(
                                    function () {
                                        return resolve(i('000f'));
                                    }.bind(null, i)
                                )
                                .catch(i.oe);
                        },
                        UserItem: function () {
                            i.e('pages/activityTicket/components/UserItem')
                                .then(
                                    function () {
                                        return resolve(i('a7f7'));
                                    }.bind(null, i)
                                )
                                .catch(i.oe);
                        },
                        Rule: function () {
                            i.e('pages/activityTicket/components/Rule')
                                .then(
                                    function () {
                                        return resolve(i('aaad'));
                                    }.bind(null, i)
                                )
                                .catch(i.oe);
                        }
                    },
                    data: function () {
                        return {
                            userList: {
                                list: [],
                                page: 1,
                                loading: false
                            },
                            ticketList: {
                                list: [],
                                page: 1,
                                loading: false
                            },
                            inviteTotal: 0,
                            stock: 0,
                            usedTotal: 0,
                            uuid: '',
                            nodeType: '',
                            current: 0,
                            perPage: 10,
                            isSharePopup: false,
                            isShowRule: false,
                            info: {}
                        };
                    },
                    computed: {
                        navBar: function () {
                            return this.$store.getters.deviceInfo.customBar;
                        },
                        userInfo: function () {
                            return this.$store.getters.userInfo;
                        }
                    },
                    onLoad: function (t) {
                        var that = this;
                        return (0, s.default)(
                            a.default.mark(function i() {
                                return a.default.wrap(function (i) {
                                    for (;;) {
                                        switch ((i.prev = i.next)) {
                                            case 0:
                                                that.uuid = t.uuid;
                                                that.nodeType = t.node_type;
                                            case 2:
                                            case 'end':
                                                return i.stop();
                                        }
                                    }
                                }, i);
                            })
                        )();
                    },
                    onUnload: function () {
                        t.$emit('refreshFreeTicketTotal');
                    },
                    onShow: function () {
                        var that = this;
                        this.$http('/activity/ticket-total', 'GET', {
                            uuid: this.uuid,
                            node_type: this.nodeType
                        }).then(function (e) {
                            that.inviteTotal = e.data.invite_total;
                            that.usedTotal = e.data.used_total;
                            that.stock = e.data.stock;
                            that.info = e.data;
                        });
                        this.initTicketList();
                        this.initUserList();
                    },
                    methods: {
                        checkRule: function () {
                            this.isShowRule = true;
                        },
                        handleShare: function () {
                            t.navigateBack();
                            t.$emit('startShare');
                        },
                        initTicketList: function () {
                            var that = this;
                            this.ticketList.loading ||
                                ((this.ticketList.loading = true),
                                this.$http('/activity/ticket-records', 'GET', {
                                    uuid: this.uuid,
                                    per_page: this.perPage,
                                    page: this.ticketList.page
                                }).then(function (e) {
                                    var i;
                                    that.ticketList.loading = false;
                                    that.ticketList.page++;
                                    that.init = true;
                                    (i = that.ticketList.list).push.apply(i, (0, u.default)(e.data.list));
                                }));
                        },
                        initUserList: function () {
                            var that = this;
                            this.userList.loading ||
                                ((this.userList.loading = true),
                                this.$http('/activity/invite-records', 'GET', {
                                    node_uuid: this.uuid,
                                    per_page: this.perPage,
                                    page: this.userList.page
                                }).then(function (e) {
                                    var i;
                                    that.userList.loading = false;
                                    that.userList.page++;
                                    that.init = true;
                                    (i = that.userList.list).push.apply(i, (0, u.default)(e.data.list));
                                }));
                        },
                        swiperChange: function (t) {
                            var e = t.detail.current;
                            this.current = e;
                        },
                        scrolltolower: function () {
                            if (1 === this.current) {
                                this.initTicketList();
                            } else {
                                if (0 === this.current) {
                                    this.initUserList();
                                }
                            }
                        }
                    }
                };
                e.default = c;
            }.call(this, i('543d').default));
        },
        b302: function (t, e, i) {
            'use strict';

            i.d(e, 'b', function () {
                return a;
            });
            i.d(e, 'c', function () {
                return u;
            });
            i.d(e, 'a', function () {
                return n;
            });
            var n = {
                TextNavBar: function () {
                    return i.e('components/TextNavBar/TextNavBar').then(i.bind(null, '9141'));
                },
                NoData: function () {
                    return i.e('components/NoData/NoData').then(i.bind(null, 'cafe'));
                }
            };
            var a = function () {
                var that = this;
                var e = (that.$createElement, that._self._c, that.userList.list.length);
                var i = that.ticketList.list.length;
                that._isMounted ||
                    ((that.e0 = function (e) {
                        that.current = 0;
                    }),
                    (that.e1 = function (e) {
                        that.current = 1;
                    }),
                    (that.e2 = function (e) {
                        that.isShowRule = false;
                    }));
                that.$mp.data = Object.assign(
                    {},
                    {
                        $root: {
                            g0: e,
                            g1: i
                        }
                    }
                );
            };
            var u = [];
        },
        b444: function (t, e, i) {
            'use strict';

            (function (t, e) {
                var n = i('4ea4');
                i('18ba');
                n(i('66fd'));
                var a = n(i('391f'));
                t.__webpack_require_UNI_MP_PLUGIN__ = i;
                e(a.default);
            }.call(this, i('bc2e').default, i('543d').createPage));
        },
        c753: function (t, e, i) {
            'use strict';

            var n = i('871e');
            i.n(n).a;
        },
        c86e: function (t, e, i) {
            'use strict';

            i.r(e);
            var n = i('aa95');
            var a = i.n(n);
            for (var u in n) {
                if (['default'].indexOf(u) < 0) {
                    (function (t) {
                        i.d(e, t, function () {
                            return n[t];
                        });
                    })(u);
                }
            }
            e.default = a.a;
        }
    },
    [['b444', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './record.css';
</style>
